package com.sanji.sjmallmodule.account;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.sanji.sjmallapp.BaseActivity;
import com.sanji.sjmallapp.R;
import com.sanji.sjmallmodule.main.MainActivity;
import com.sanji.sjmallwidget.XListView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/****
 * 我的红包
 */
public class MyRedPacketDetailActivity extends BaseActivity implements View.OnClickListener, XListView.IXListViewListener {
    @BindView(R.id.common_back_img)
    ImageView commonBackImg;
    @BindView(R.id.common_left_tv)
    TextView commonLeftTv;
    @BindView(R.id.red_packet_list_view)
    XListView redPacketListView;
    @BindView(R.id.common_right_img)
    ImageView commonRightImg;
    private RedPacketsAdapter redPacketsAdapter;
    private List<RedPacketsBean> mData;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_wallet_detail);
        ButterKnife.bind(this);
        initView();
    }

    public void initView() {
        commonLeftTv.setText(getString(R.string.my_red_packet));
        commonRightImg.setVisibility(View.VISIBLE);
        commonRightImg.setImageResource(R.mipmap.my_little_img);
        commonBackImg.setOnClickListener(this);
        commonRightImg.setOnClickListener(this);
        mData = new ArrayList<>();
        //模拟数据
//        mData.add(new RedPacketsBean(5.00, true, "满100元可用", "本红包到次月七号到账本红包到次月七号到账本红包到次月七号到账本红包到次月七号到账", "2016-04可用", "恭喜发财"));
//        mData.add(new RedPacketsBean(5.00, false, "满100元可用", "本红包到次月七号到账", "2016-04可用", "恭喜发财"));
        redPacketsAdapter = new RedPacketsAdapter(mData, this);
        redPacketListView.setAdapter(redPacketsAdapter);
        redPacketListView.setPullLoadEnable(false);
        redPacketListView.setFooterDividersEnabled(false);
        redPacketListView.setHeaderDividersEnabled(false);
        redPacketListView.setXListViewListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.common_back_img:
                finish();
                break;
            case R.id.common_right_img:
                Intent intent = new Intent(this, MainActivity.class);
                startActivity(intent);
                break;
        }
    }


    @Override
    public void onRefresh() {

    }

    @Override
    public void onLoadMore() {

    }
}
